package network;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

import main.TDMap;

public class NetworkLink implements Runnable {

	private static final int PORT = 1313;
	private TDMap map;

	public static void main(String[] args) throws IOException {
	}

	
	public NetworkLink(TDMap tdmap) {
		map = tdmap;
	}

	@Override
	public void run() {
		try {
			ServerSocket serv = new ServerSocket(PORT);

			while (true) {
				Socket client = serv.accept();
				Thread c = new Thread(new NetworkClient(client, map));
				c.start();
				System.out.println("started");
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
